var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var UI_GameFail_UIBindings = require("AA_UI_GameFail_UIBindings");
var UIView = require("AA_UIView");
var ADManager = require("AA_ADManager");
var GameGlobalVariable = require("AA_GameGlobalVariable");
var GameDataManager = require("AA_GameDataManager");
var CommonUtils = require("AA_CommonUtils");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_GameFail = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.auto_ui = null;
    t.nowdata = {};
    t.time = 10;
    t.offtime = 0;
    t.isjishi = false;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype._show = function (e) {
    var t = [];
    for (var o = 1; o < arguments.length; o++) {
      t[o - 1] = arguments[o];
    }
    this.nowdata = e;
    this.isjishi = false;
    CommonUtils.default.cleanGold();
  };
  _creator.prototype._clickListener = function (e) {
    var t = this.auto_ui;
    switch (e) {
      case t.btn_fuhuo:
        this.onFuHuo();
        break;
      case t.btn_nofuhuo:
        this.onBackHome();
    }
  };
  _creator.prototype.onFuHuo = function () {
    var e = this;
    var t = "视频复活";
    if (1 == GameGlobalVariable.GameGlobalVariable.isTeShuLevel()) {
      t = "无尽模式视频复活";
    } else {
      var o = GameDataManager.GameDataMgr.getNowLevelBoshuState(GameGlobalVariable.GameGlobalVariable.nowlevel, 2) + 1;
      t = GameGlobalVariable.GameGlobalVariable.nowlevel + "章_" + o + "波_" + t;
    }
    ADManager.ADMgr.showRewardedVideo(t, function () {
      GameGlobalVariable.GameGlobalVariable.gamefuhuo = true;
      e.nowdata.back(1);
      e.onCloseView();
    });
  };
  _creator.prototype.onBackHome = function () {
    this.nowdata.back(4);
    this.onCloseView();
  };
  _creator.prototype.onCloseView = function () {
    this._close();
  };
  _creator.prototype.updateTime = function () {};
  _creator.prototype.jianTime = function () {
    this.time -= 1;
    this.updateTime();
    if (this.time <= 0) {
      this.isjishi = true;
      this.onBackHome();
    }
  };
  _creator.prototype.update = function (e) {
    if (!this.isjishi) {
      this.offtime += e;
      this.offtime >= 1 && (this.offtime = 0);
    }
  };
  __decorate([_property(UI_GameFail_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  return __decorate([_ccclass], _creator);
}(UIView.default);
exports.default = _def_UI_GameFail;